/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package br.ufrn.generativemodel.generativemodel.impl;

import br.ufrn.generativemodel.generativemodel.AssetData;
import br.ufrn.generativemodel.generativemodel.FeatureData;
import br.ufrn.generativemodel.generativemodel.GenerativeModel;
import br.ufrn.generativemodel.generativemodel.GenerativemodelPackage;
import br.ufrn.generativemodel.generativemodel.MappingData;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Generative Model</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link br.ufrn.generativemodel.generativemodel.impl.GenerativeModelImpl#getAssetData <em>Asset Data</em>}</li>
 *   <li>{@link br.ufrn.generativemodel.generativemodel.impl.GenerativeModelImpl#getMappingData <em>Mapping Data</em>}</li>
 *   <li>{@link br.ufrn.generativemodel.generativemodel.impl.GenerativeModelImpl#getFeatureData <em>Feature Data</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class GenerativeModelImpl extends EObjectImpl implements GenerativeModel {
	/**
	 * The cached value of the '{@link #getAssetData() <em>Asset Data</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAssetData()
	 * @generated
	 * @ordered
	 */
	protected AssetData assetData;

	/**
	 * The cached value of the '{@link #getMappingData() <em>Mapping Data</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMappingData()
	 * @generated
	 * @ordered
	 */
	protected MappingData mappingData;

	/**
	 * The cached value of the '{@link #getFeatureData() <em>Feature Data</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFeatureData()
	 * @generated
	 * @ordered
	 */
	protected FeatureData featureData;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected GenerativeModelImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return GenerativemodelPackage.Literals.GENERATIVE_MODEL;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AssetData getAssetData() {
		return assetData;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetAssetData(AssetData newAssetData, NotificationChain msgs) {
		AssetData oldAssetData = assetData;
		assetData = newAssetData;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GenerativemodelPackage.GENERATIVE_MODEL__ASSET_DATA, oldAssetData, newAssetData);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAssetData(AssetData newAssetData) {
		if (newAssetData != assetData) {
			NotificationChain msgs = null;
			if (assetData != null)
				msgs = ((InternalEObject)assetData).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GenerativemodelPackage.GENERATIVE_MODEL__ASSET_DATA, null, msgs);
			if (newAssetData != null)
				msgs = ((InternalEObject)newAssetData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GenerativemodelPackage.GENERATIVE_MODEL__ASSET_DATA, null, msgs);
			msgs = basicSetAssetData(newAssetData, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GenerativemodelPackage.GENERATIVE_MODEL__ASSET_DATA, newAssetData, newAssetData));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingData getMappingData() {
		return mappingData;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetMappingData(MappingData newMappingData, NotificationChain msgs) {
		MappingData oldMappingData = mappingData;
		mappingData = newMappingData;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GenerativemodelPackage.GENERATIVE_MODEL__MAPPING_DATA, oldMappingData, newMappingData);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMappingData(MappingData newMappingData) {
		if (newMappingData != mappingData) {
			NotificationChain msgs = null;
			if (mappingData != null)
				msgs = ((InternalEObject)mappingData).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GenerativemodelPackage.GENERATIVE_MODEL__MAPPING_DATA, null, msgs);
			if (newMappingData != null)
				msgs = ((InternalEObject)newMappingData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GenerativemodelPackage.GENERATIVE_MODEL__MAPPING_DATA, null, msgs);
			msgs = basicSetMappingData(newMappingData, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GenerativemodelPackage.GENERATIVE_MODEL__MAPPING_DATA, newMappingData, newMappingData));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureData getFeatureData() {
		return featureData;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetFeatureData(FeatureData newFeatureData, NotificationChain msgs) {
		FeatureData oldFeatureData = featureData;
		featureData = newFeatureData;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GenerativemodelPackage.GENERATIVE_MODEL__FEATURE_DATA, oldFeatureData, newFeatureData);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFeatureData(FeatureData newFeatureData) {
		if (newFeatureData != featureData) {
			NotificationChain msgs = null;
			if (featureData != null)
				msgs = ((InternalEObject)featureData).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GenerativemodelPackage.GENERATIVE_MODEL__FEATURE_DATA, null, msgs);
			if (newFeatureData != null)
				msgs = ((InternalEObject)newFeatureData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GenerativemodelPackage.GENERATIVE_MODEL__FEATURE_DATA, null, msgs);
			msgs = basicSetFeatureData(newFeatureData, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GenerativemodelPackage.GENERATIVE_MODEL__FEATURE_DATA, newFeatureData, newFeatureData));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case GenerativemodelPackage.GENERATIVE_MODEL__ASSET_DATA:
				return basicSetAssetData(null, msgs);
			case GenerativemodelPackage.GENERATIVE_MODEL__MAPPING_DATA:
				return basicSetMappingData(null, msgs);
			case GenerativemodelPackage.GENERATIVE_MODEL__FEATURE_DATA:
				return basicSetFeatureData(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case GenerativemodelPackage.GENERATIVE_MODEL__ASSET_DATA:
				return getAssetData();
			case GenerativemodelPackage.GENERATIVE_MODEL__MAPPING_DATA:
				return getMappingData();
			case GenerativemodelPackage.GENERATIVE_MODEL__FEATURE_DATA:
				return getFeatureData();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case GenerativemodelPackage.GENERATIVE_MODEL__ASSET_DATA:
				setAssetData((AssetData)newValue);
				return;
			case GenerativemodelPackage.GENERATIVE_MODEL__MAPPING_DATA:
				setMappingData((MappingData)newValue);
				return;
			case GenerativemodelPackage.GENERATIVE_MODEL__FEATURE_DATA:
				setFeatureData((FeatureData)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case GenerativemodelPackage.GENERATIVE_MODEL__ASSET_DATA:
				setAssetData((AssetData)null);
				return;
			case GenerativemodelPackage.GENERATIVE_MODEL__MAPPING_DATA:
				setMappingData((MappingData)null);
				return;
			case GenerativemodelPackage.GENERATIVE_MODEL__FEATURE_DATA:
				setFeatureData((FeatureData)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case GenerativemodelPackage.GENERATIVE_MODEL__ASSET_DATA:
				return assetData != null;
			case GenerativemodelPackage.GENERATIVE_MODEL__MAPPING_DATA:
				return mappingData != null;
			case GenerativemodelPackage.GENERATIVE_MODEL__FEATURE_DATA:
				return featureData != null;
		}
		return super.eIsSet(featureID);
	}

} //GenerativeModelImpl
